<?php
namespace App\Api\Rules;

use App\Models\User\Users;
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Contracts\Validation\DataAwareRule;


class ContactVerify implements Rule, DataAwareRule{
    protected $data = [];

    public function setData($data){
        $this->data = $data;
        return $this;
    }

    public function passes($attribute, $value){
        foreach(['weixin', 'qq', 'email'] as $v){
            if(!empty($this->data[$v]) && $this->data[$v] != ''){
                return true;
            }
        }
        return false;
    }

    public function message(){
        return "联系方式至少要填写一项";
    }
}